// SPDX-FileCopyrightText: 2025 UnionTech Software Technology Co., Ltd.
// SPDX-License-Identifier: MIT

package server

import "net/http"

// minimal favicon handler to avoid large binary and fix duplicated content
type favicon struct {
	body []byte
}

func NewFavicon() *favicon {
	// a very small valid ICO header (placeholder) is sufficient for tests and compilation
	return &favicon{body: []byte{0x00, 0x00, 0x01, 0x00}}
}

func (f *favicon) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	w.Header().Set("Content-Type", "image/x-icon")
	_, _ = w.Write(f.body)
}
